<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<html>
	<head>
		<title>新会员免费注册</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">

		<LINK href="<%=request.getContextPath()%>/css/cssCn.css"
			type="text/css" rel="stylesheet">
		<%@ include file="/comm.jsp"%>
<script>
		$(document).ready(function() {
			$("form *").autohelp("#autohelp");
		});
		  $(document).ready(function(){
		    $('#ok').click(function() { 
		    $('#regist_exec').submit(); 
		    }) 
		    $("#regist_exec").validate(
		    );
		  });
</script>

<script type="text/javascript">
   function reloadVerifyCode(){
      var timenow = new Date().getTime();                        
      document.getElementById("chkImg").src="<%=request.getContextPath()%>/simpleCaptcha.jpg?d="+timenow;
   }
   
   function selCountryChange(){
   	  var form=document.getElementById("formpage");
	  form.action="regist_selChange.do";
	  form.submit(); 
   }
   
   function initPage(){
      var selcountry=document.getElementById("companyInfo.country").value;   		
   	  if(selcountry=="HK"||selcountry=="CN"||selcountry=="TW"){
   	  	//中国或香港,显示手机、中文名等
   	  	document.getElementById("tr_zhname").style.display="block";
   	  	if(selcountry=="CN")
   	  	  document.getElementById("tr_mobile").style.display="block";
   	  	else
   	  	  document.getElementById("tr_mobile").style.display="none";
   	  }else{
   	  	document.getElementById("tr_zhname").style.display="none";
   	  	document.getElementById("tr_mobile").style.display="none";
   	  }
   }
   
   var checkEmailflag=true;
   function checkEmail(txtEmail){
		var emailStr=txtEmail.value;
		if(emailStr == ""){
			$d("emailError").innerHTML="请输入Email";
			return;		
		}
		var params = {
					userId:'',
					email:emailStr
					};
		$.ajax({type: "POST",
		       url: "ajaxPwd_checkEmailExist.do",
		       data: params,
		       async: true,
		       success: function(result){
				 if(result.retcode=='0000'){
				  	emailError.innerHTML="";
				  	checkEmailflag=true;
				 }else{
				  	emailError.innerHTML=result.retmsg;
				 	checkEmailflag=false;
				 }
			  }
			},"json");
	}
	
	function checkSubmit(){
		if(checkEmailflag==false){
			alert("Email已被占用");
			return false;
		}
		
		return true;
	}
</script>
	<body leftmargin="0" topmargin="0" marginheight="0" onload="initPage();">
		<s:form name="formpage" action="regist_exec" namespace="/">
			<s:token>
			</s:token>
			<div align="center">
				<%@ include file="/messages.jsp"%>
				<table align="left" width="700px" border="0" cellpadding="0"
					cellspacing="1">
					<tr>
						<td align="right">
							国家:
						</td>
						<td>
							 <s:select name="companyInfo.country" list="#request.countryList"
							 onchange="selCountryChange();"
							 ></s:select>
						</td>
					</tr>

					<tr>
						<td colspan="2">
							请输入您的个人信息---------------------------------------------------------------------
						</td>
					</tr>

					<tr id="tr_zhname">
						<td align="right">
							中文姓名:
						</td>
						<td>
							<input name="userInfo.chineseName" id="carrierNo" type="text"
								maxlength="40" size="20" class="required" value="" title="*必填" />
						</td>
					</tr>

					<tr>
						<td align="right">
							英文姓名:
						</td>
						<td>
							<input name="userInfo.firstName" type="text" maxlength="20" size="10"
								value="" title="first name"/>
							<input name="userInfo.lastName" type="text" maxlength="20" size="10"
								value="" title="last name"/>
						</td>
					</tr>

					<tr id="tr_mobile">
						<td align="right">
							手机:
						</td>
						<td>
							<input name="userInfo.cellphone" type="text" maxlength="40"
								 value=""  />
						</td>
					</tr>

					<tr>
						<td align="right">
							固定电话:
						</td>
						<td>
							<input name="userInfo.countryCode" type="text" maxlength="10" size="5"
								value="86" />
							<input name="userInfo.regionCode" type="text" maxlength="10" size="5"
								value="" />
							<input name="userInfo.telephone" type="text" maxlength="20" size="15"
								value="" />
						</td>
					</tr>

					<tr>
						<td colspan="2">
							请输入你的公司信息---------------------------------------------------------------------
						</td>
					</tr>

					<tr>
						<td align="right">
							公司名称:
						</td>
						<td>
							<input name="companyInfo.companyName" type="text" maxlength="40" size="30"
								class="required" value="" title="*必填" />
						</td>
					</tr>
					<tr>
						<td align="right">
							联系地址:
						</td>
						<td>
							<input name="companyInfo.address" type="text" maxlength="40" size="30"
								class="required" value="" title="*必填" />
						</td>
					</tr>

					<tr>
						<td colspan="2">
							请输入您的email以及创建登录密码-----------------------------------------------------
						</td>
					</tr>

					<tr>
						<td align="right">
							电子邮箱:
						</td>
						<td>
							<input name="userInfo.email" type="text" maxlength="50" size="30"
								 value="" title="*必填" 
							onblur="checkEmail(this);" />
							<span id="emailError"></span>
						</td>
					</tr>

					<tr>
						<td align="right">
							创建登录密码:
						</td>
						<td>
							<input name="userInfo.password" id="password1" type="password" size="20"
								maxlength="20" class="required" value="" title="*必填" />
						</td>
					</tr>

					<tr>
						<td align="right">
							再次输入密码:
						</td>
						<td>
							<input name="password2" id="password2" type="password" size="20"
								maxlength="20" class="required" value="" title="*必填" />
						</td>
					</tr>
 					<tr>
						<td align="right">
							输入验证码:
						</td>
						<td>
							<input type="text" name="userInfo.remark"
								class="smallInput" size="8" maxlength="10" />

							<img id="chkImg"
								src="<%=request.getContextPath()%>/simpleCaptcha.jpg" onclick="reloadVerifyCode();"/>
							看不清？
							<a onclick="reloadVerifyCode();" href="#">换一张</a>
						</td>
					</tr>
					
					<tr>
						<td>
							&nbsp;
						</td>
						<td>
							<br />
							<input type="checkbox" checked="checked" id="serviceItemChek"  />
							 同意“<a href="<%=request.getContextPath()%>/doc.do\?page=agreement" target="_blank">服务条款</a>	”和“
							<a href="<%=request.getContextPath()%>/doc.do\?page=agreement" target="_blank">隐私权保护和个人信息利用政策</a>
							” 
						</td>
					</tr>
					<tr>
						<td colspan="2">
							&nbsp;
						</td>
					</tr>
					<tr>
						<td>
							&nbsp;
						</td>
						<td>
							<input type="button" class="button" id="ok" name="ok"
								value=" 创建新账户 " onclick="return checkSubmit();"/>
						</td>
					</tr>
				</table>
				<br />
				<div>

				</div>
			</div>
		</s:form>
	</body>
</html>